import { axios, api } from '@/Axios/index.js';
import _ from 'lodash';

export default {
  namespaced: true,
  state: {
    ceid: 0,
    employeeName: '',
    employeeUserId: '',
    encEmployeeUserId: '',
    face: '',
  },
  mutations: {
    setInfo: function (state, { ceid, data }) {
      state.ceid = ceid
      state.employeeName = data.employeeName
      state.employeeUserId = data.employeeUserId
      state.encEmployeeUserId = data.encEmployeeUserId
      state.face = data.imgUrl
    }
  },
  getters: {
    getCEID: function (ctx) {
      return ctx.ceid;
    }
  },
  actions: {
    updata: function (ctx, { ceid: ceid }) {
      return api.getInitConfigs({ ceid }).then((res) => {
        ctx.commit('setInfo', { ceid: ceid, data: res[0].data });
        return Promise.resolve('200')
      })
    }
  },
}